package com.hobart.learning.lagou.edu.demo.controller;

import com.hobart.learning.lagou.edu.demo.service.ILagouDemoService;
import com.hobart.learning.lagou.edu.lagouframework.annotation.LagouAutowired;
import com.hobart.learning.lagou.edu.lagouframework.annotation.LagouController;
import com.hobart.learning.lagou.edu.lagouframework.annotation.LagouRequestMapping;
import com.hobart.learning.lagou.edu.lagouframework.annotation.LagouSecurity;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author: Hobart Mr.Bai
 * @create: 2021-03-31 18:09
 * @description:
 * @Version 1.0
 **/
@LagouController
@LagouRequestMapping("/demo")
public class LagouDemoController {

    @LagouAutowired
    private ILagouDemoService lagouDemoService;

    @LagouRequestMapping("/handle01")
    @LagouSecurity({"tom", "jerry"})
    public String getName(HttpServletRequest request, HttpServletResponse response, String userName){
        return lagouDemoService.getUserName(userName);
    }

    @LagouRequestMapping("/handle02")
    @LagouSecurity({"tom"})
    public String getUser(HttpServletRequest request, HttpServletResponse response, String userName){
        return "user: "+userName;
    }

    @LagouRequestMapping("/handle03")
    @LagouSecurity({"jerry"})
    public String getStudent(HttpServletRequest request, HttpServletResponse response, String userName){
        return "student"+userName;
    }
}
